import { ref, computed,reactive } from 'vue'
import { defineStore } from 'pinia'

export const classBasic = defineStore('classBasic', () => {
//   const count = ref(0)
//   const doubleCount = computed(() => count.value * 2)
//   function increment() {
//     count.value++
//   }

  const type=ref("");
  // 编辑课程基本信息
const basicInfo = reactive({
  is_compilation: null,
  class_name: "",
  thematic_id: "",//合集if
  thematic_name: "",//合集名称
  img: "",
  class_type:null,//是否收费
  teaching_services:"",//教学服务
});

// 添加的课程
const aclass=<any>reactive({
	"className": "",
	"classType": 0,
	"createTime": "",
	"enlistsNum": 0,
	"id": 0,
	"img": "",
	"isCompilation": 0,
	"isShelves": 0,
	"price": 0,
	"recentNum": 0,
	"teacherId": 0,
	"teachingServices": "",
	"thematicId": 0
});

function changeClass(classs:any){
	// console.log(classs);
	console.log(classs.id);
	
	aclass.className=classs.className;
	aclass.classType=classs.classType;
	aclass.createTime=classs.createTime;
	aclass.id=classs.id;
	aclass.img=classs.img;
	aclass.isCompilation=classs.isCompilation;
	aclass.isShelves=classs.isShelves;
	aclass.price=classs.price;
	aclass.recentNum=classs.recentNum;
	aclass.teacherId=classs.teacherId;
	aclass.teachingServices=classs.teachingServices;
	// console.log(aclass);
	
}
function clearClass(){
	// console.log(classs);
	
	aclass.className="";
	aclass.classType=null;
	aclass.createTime="";
	aclass.id=null;
	aclass.img="";
	aclass.isCompilation=null;
	aclass.isShelves=null;
	aclass.price=null;
	aclass.recentNum=null;
	// aclass.teacherId=classs.teacherId;
	aclass.teachingServices="";
	// console.log(aclass);
	
}

const img: any = reactive([]);

  return { basicInfo ,aclass,changeClass,type,clearClass,img}
})


